<template>
	<view>
		<cu-custom bgColor="bg-gradual-green" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">版本日志</block>
		</cu-custom>
		<view class="cu-timeline">
			<view class="cu-item cur text-green" v-for="v in versionList">
				<view class="content bg-gradual-green shadow-blur ">
					<view class="cu-capsule radius ">
						<view class="cu-tag bg-white  text-green" >{{v.tag}}</view>
						<view class="cu-tag line-white " >{{ $u.timeFormat(new Date(v.createTime).getTime(), 'yyyy-mm-dd')}}</view>
					</view>
					<view class="margin-top-xs">
						<u-parse :html="v.description"></u-parse>
					</view>
				</view>
			</view>
		</view>
		<view class="margin-tb">
			<u-loadmore icon-type="flower" :status="loadingStatus" bg-color="#fff" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				total: 0,
				pages: 0,
				loadingStatus:'loadmore',
				queryParams: {
					current: 1,
					size: 10,
					params: {
					}
				},
				versionList: []
			}
		},
		onLoad() {
			this.pageVersion();
		},
		onReachBottom() {
			this.queryParams.current++;
			this.pageVersion();
		},
		methods: {
			pageVersion() {
				this.loadingStatus = 'loading';
				this.$u.api.pageVersion(this.queryParams).then(res => {
					if (this.queryParams.current == 1) {
						this.versionList = [];
					}
					this.versionList = this.versionList.concat(res.data.records);
					this.total = res.data.total;
					this.pages = res.data.pages;
					this.refresherFlag = false;
					if(this.pages<=this.queryParams.current){
						this.loadingStatus = 'nomore';
					}else{
						this.loadingStatus = 'loadmore';
					}
				});
			},
		}
	}
</script>

<style>
page{
	background: #fff;
}
</style>
